@using QuixoteWeb;
@using BlogEngine.Core;
@using BlogEngine.Core.Packaging;
@using BlogEngine.Core.Json;
@using BlogEngine.Core.Web.Navigation;

@{
    Layout = "_layout.cshtml";
    var pkgDir = HttpContext.Current.Server.MapPath(Utils.ApplicationRelativeWebRoot + "App_Data/packages/");
    var extDir = HttpContext.Current.Server.MapPath(Utils.ApplicationRelativeWebRoot + "App_Code/Extensions/");
    var themeDir = HttpContext.Current.Server.MapPath(Utils.ApplicationRelativeWebRoot + "themes/");
    var wdgDir = HttpContext.Current.Server.MapPath(Utils.ApplicationRelativeWebRoot + "widgets/");
}

@TheFollowing.Describes("Tests for dnbegallery.org packages (Core.Packaging)")

<div class="left-padded"><a href="default.cshtml"><span class="go-back"></span></a></div>

<!-- extension -->

@It.Should("be able to install extension [mp3player]", () => {

    JsonResponse rsp = Installer.InstallPackage("Mp3Player");  
    return (rsp.Success).ShouldBeTrue();
})

@It.Should("be ablde to verify that installed [mp3player] files exist", () =>
{
    var ext = File.Exists(extDir + "Mp3Player.cs");
    
    return (ext).ShouldBeTrue();
})

@It.Should("be able to uninstall extension [mp3player]", () => {

    JsonResponse rsp = Installer.UninstallPackage("Mp3Player");    
    return (rsp.Success).ShouldBeTrue();
})

<!-- theme -->

@It.Should("be able to install theme [Modern]", () => {

    JsonResponse rsp = Installer.InstallPackage("Modern");  
    return (rsp.Success).ShouldBeTrue();
})

@It.Should("be ablde to verify that installed [Modern] files exist", () =>
{
    var theme = Directory.Exists(themeDir + "Modern");
    
    return (theme).ShouldBeTrue();
})

@It.Should("be able to uninstall theme [Modern]", () => {

    JsonResponse rsp = Installer.UninstallPackage("Modern");    
    return (rsp.Success).ShouldBeTrue();
})

<!-- widget -->

@It.Should("be able to install widget [FlickrBar]", () => {

    JsonResponse rsp = Installer.InstallPackage("FlickrBar");  
    return (rsp.Success).ShouldBeTrue();
})

@It.Should("be ablde to verify that installed [FlickrBar] files exist", () =>
{
    var theme = Directory.Exists(wdgDir + "FlickrBar");
    
    return (theme).ShouldBeTrue();
})

@It.Should("be able to uninstall theme [FlickrBar]", () => {

    JsonResponse rsp = Installer.UninstallPackage("FlickrBar"); 
    return (rsp.Success).ShouldBeTrue();
})


<div class="left-padded"><a href="default.cshtml"><span class="go-back"></span></a></div>